//---------------------------------------------------------------------------

#include "vcl_stl.h"
#pragma hdrstop

#include "t_selectgroupform.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TSelectGroupForm *SelectGroupForm;
//---------------------------------------------------------------------------
__fastcall TSelectGroupForm::TSelectGroupForm(TComponent* Owner)
   : TForm(Owner)
{
}
//---------------------------------------------------------------------------
int __fastcall TSelectGroupForm::Select(const map<UTF8String, int> &AllGroups)
{
   map<UTF8String, int>::const_iterator Iter;

   OkFlag = false;
   ComboBoxGroup->Items->Clear();

   for( Iter = AllGroups.begin();
        Iter != AllGroups.end(); Iter++ )
      ComboBoxGroup->Items->Add(Iter->first);

   ComboBoxGroup->ItemIndex = 0;
   ShowModal();

   if( OkFlag )
   {
      Iter = AllGroups.find(ComboBoxGroup->Text);
      if( Iter == AllGroups.end() )
         return -1;
      return Iter->second;
   }
   else
      return -1;

}
void __fastcall TSelectGroupForm::ButtonOkClick(TObject *Sender)
{
   OkFlag = true;
   Close();
}
//---------------------------------------------------------------------------
void __fastcall TSelectGroupForm::ButtonCancelClick(TObject *Sender)
{
   Close();
}
//---------------------------------------------------------------------------

